package com.zhongxi.guoyuan.entity.coinStore;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;

/**
 * Created by Administrator on 2017/6/28.
 */

public class ItemGoodAttr implements Serializable{
    private String id;
    private String attrk;
    private String attrv;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAttrk() {
        return attrk;
    }

    public void setAttrk(String attrk) {
        this.attrk = attrk;
    }

    public String getAttrv() {
        return attrv;
    }

    public void setAttrv(String attrv) {
        this.attrv = attrv;
    }

    public static ItemGoodAttr parseMatch(JSONObject jsonObject) {
        ItemGoodAttr itemGoodAttr = null;
        try {
            itemGoodAttr = new ItemGoodAttr();
            itemGoodAttr.setId(jsonObject.optString("id"));
            itemGoodAttr.setAttrk(jsonObject.optString("attrk"));
            itemGoodAttr.setAttrv(jsonObject.optString("attrv"));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return itemGoodAttr;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ItemGoodAttr that = (ItemGoodAttr) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (attrk != null ? !attrk.equals(that.attrk) : that.attrk != null) return false;
        return attrv != null ? attrv.equals(that.attrv) : that.attrv == null;

    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (attrk != null ? attrk.hashCode() : 0);
        result = 31 * result + (attrv != null ? attrv.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "ItemGoodAttr{" +
                "id='" + id + '\'' +
                ", attrk='" + attrk + '\'' +
                ", attrv='" + attrv + '\'' +
                '}';
    }
}
